home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 27
/
CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso
/
CUCD
/
Online
/
News
/
Thor
/
rexx
/
examples
/
ListFiles.br
< prev
next >
Wrap
Text File
|
1997-09-15
|
2KB
|
126 lines
/* $VER: ListFiles.br 1.0 (6.9.95)
*
* Arexx script to list all files on a bbs
*
* Script by: Eivind Nordseth, Ultima Thule Software.
*/
options results
/* trace results */
parse arg argument
template = 'BBSNAME/A,FAREANAME'
if(argument = '' | argument = '?') then
do
say '$VER: ListFiles.br 3.4 (12.09.94)'
say 'Template:' template
exit
end
if ~show('p', 'BBSREAD') then do
address command
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
end
address BBSREAD
rc = 0
signal on ERROR
READARGS template ARGS CMDLINE argument
if(rc ~= 0) then
do
say BBSREAD.LASTERROR
exit
end
if(symbol("ARGS.FAREANAME") = "VAR") then
do
call showfilearea('"' || ARGS.BBSNAME || '"', '"' || ARGS.FAREANAME || '"')
end
else
do
GETFAREALIST ARGS.BBSNAME FAREAS
do i=1 to FAREAS.COUNT
call showfilearea('"' || ARGS.BBSNAME || '"', '"' || FAREAS.i || '"')
end
end
exit
/* Procedure to show the files in a file area */
showfilearea: procedure
parse arg bbs,farea
GETFAREADATA bbs farea FAREADATA
say '0a'x || '(' || strip(farea,B,'"') || ')'
nextfile = FAREADATA.FIRSTFILE
do until nextfile = 0
nextfile = showfiledata(bbs, farea, nextfile)
end
return
/* Procedure to show the data about a file */
showfiledata: procedure
parse arg bbs,farea,filenr
FDF_DELETED = '00000001'x
drop FILE. /* Important */
READBRFILE bbs farea filenr tagsstem FILE datastem DATA
nextfile = result
if (bitand(DATA.FLAGS,FDF_DELETED) ~= FDF_DELETED) then
do
if(symbol("FILE.DATE") = "VAR") then fdate = FILE.DATE
else fdate = DATA.FILEDATE
AMIGA2DATE fdate CD
fdatestr = right(CD.YEAR, 2) || right('0'||CD.MONTH, 2) || right('0'||CD.MDAY, 2)
if(symbol("FILE.SIZE") = "VAR") then fsize = FILE.SIZE
else fsize = "Unkn"
if(symbol("FILE.DOWNLOADS") = "VAR") then fdnls = FILE.DOWNLOADS
else fdnls = "Unkn"
if(symbol("FILE.DESCRIPTION.COUNT") = "VAR") then descr = FILE.DESCRIPTION.1
else descr = "NONE"
say left(FILE.NAME,16) || " " || fdatestr || " " || right(fsize,7) || right(fdnls,4) || " " || descr
if(descr ~= "NONE") then
do
if(FILE.DESCRIPTION.COUNT > 1) then
do
do n=2 to FILE.DESCRIPTION.COUNT
say left("",37) || FILE.DESCRIPTION.n
end
end
end
end
else say 'File is deleted'
return nextfile
ERROR:
if(rc ~= 0) then
do
say 'Error' rc 'in line' SIGL ':' BBSREAD.LASTERROR
exit
end
exit